<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增案例')" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-case-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">封面：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="cover">
                    <div class="file-loading">
                        <input class="form-control image-upload" id="cover" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">标题：</label>
                <div class="col-sm-8">
                    <input name="title" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">客户：</label>
                <div class="col-sm-8">
                    <input name="customer" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">背景：</label>
                <div class="col-sm-8">
                    <textarea name="issue" class="form-control" require rows="10"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">解决方案：</label>
                <div class="col-sm-8">
                    <select id="solutionId" name="solutionId"  class="form-control select2">
                        <option value="0">无</option>
                        <option th:each="solution:${solutions}" th:value="${solution.id}" th:text="${solution.title}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">内容：</label>
                <div class="col-sm-8">
                    <script id="content" name="content" type="text/plain" ></script>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">效果：</label>
                <div class="col-sm-8">
                    <textarea name="result" class="form-control" required rows="10"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('lk_ii_status')}">
                        <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
                        <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <th:block th:include="include :: ueditor" />
    <th:block th:include="ii/common::image-upload" />
    <script th:inline="javascript">
        var prefix = ctx + "ii/case"
        $("#form-case-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-case-add').serialize());
            }
        }
        $(function() {
            $('#solutionId').select2({
                placeholder:"请选择解决方案",
                allowClear: true
            });

            var ue = UE.getEditor('content');
            $("#content").css("height","380px");
        });
    </script>
</body>
</html>